<?php 
include "includes/comunes.php";
$sql="select * from cuotasCredito where saldo=0 and estado=1";
$restipo= cons_ins($sql);
$tot=0;

while ($reg=mysql_fetch_array($restipo)):


$sql2="UPDATE cuotasCredito
   SET estado = 2
 WHERE creditoId=".$reg['creditoId']." and cuota=".$reg['cuota'];
//echo $sql;
$consultar=  cons_ins($sql2);
$tot++;
endwhile;
echo $tot;


?>